package com.jiyang.jyandroid.other;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.jiyang.jyandroid.R;
import com.jiyang.jyandroid.bean.Book;

/**
 * Created by jy on 2016/12/1.
 * 图书详情Fragment
 */

public class BookFragment extends Fragment {
    private View rootView;
    private TextView title, content;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        rootView = inflater.inflate(R.layout.fragment_book, container, false);
        initView();
        return rootView;
    }

    private void initView() {
        title = (TextView) rootView.findViewById(R.id.tv_title);
        content = (TextView) rootView.findViewById(R.id.tv_book_content);
    }

    public void setData(Book data) {
        title.setText("《" + data.title + "》");
        content.setText(data.details);
    }


}
